package edu.towson.forensics;

import android.app.ListActivity;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.widget.SimpleCursorAdapter;

public class LogList extends ListActivity{
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        SQLiteDatabase db = (new LogDBHelper(this)).getReadableDatabase();
        // Get a cursor with all phones
        Cursor c = db.query(LogDBHelper.T_LOG, null, null, null, null, null, "_id DESC", "30");
//        startManagingCursor(c);

        // Map Cursor columns to views defined in simple_list_item_2.xml
        SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
                android.R.layout.simple_list_item_2, c,
                        new String[] {
        					LogDBHelper.KEY_LOG,
        					LogDBHelper.KEY_TIME
                        },
                        new int[] { android.R.id.text1, android.R.id.text2 });

        setListAdapter(adapter);
//        c.close();
        db.close();
        
    }

}	


